
from multiprocessing.dummy import Process
import os
import string
from threading import Thread
import time
class useless:
    class string:
        def swap(string):
            __Str__=""#string_2
            for str_ in string:
                __Str__=str_+__Str__#stitch
            return __Str__
        def seektowrite(string,start,item):
            __Str__=string
            str2_=__Str__[(start+len(item)):]#over
            str3_=__Str__[:start]+item+str2_#stitch
            return str3_
    class thread:
        def ntrun(func):#no args(decoration edition????)
            __ThreaD__=Thread(target=func)
            __ThreaD__.start()
            return __ThreaD__
        def overreturn_ntrun(func):
            __ThreaD__=Thread(target=func)
            __ThreaD__.start()
            __ThreaD__.join()
            return __ThreaD__
        def ntrun_arg(func,args):#can add args
            __ThreaD__=Thread(target=func,args=args)
            __ThreaD__.start()
            return __ThreaD__
        def overreturn_ntrun_arg(func,args):#let the program not explode and wait thread over(no return thread)
            __ThreaD__=Thread(target=func,args=args)
            __ThreaD__.start()
            __ThreaD__.join()
            return 1
    class process:
        def killprocess(processname):
            os.system(f"taskkill /f /im {processname}")
        def killprocess_pid(processpid):
            os.system(f"taskkill /f /im pid {processpid}")
        #use system command to kill command
        def startnewprocess(target):
            __pro__=Process(target=target)
            __pro__.start()
            return __pro__
        #return process to let other fun use it
if __name__=="__main__":
    def __test__():#test code
        a="1234567890"
        print(useless.string.seektowrite(string=a,start=2,item="123"))
        print(useless.string.swap(a))
        #string test
        @useless.thread.ntrun
        #thread test
        def __funtest_process_and_thread_154344624_91234823878237489__():
            time.sleep(1)
            print("sb")
            return 0
        @useless.process.startnewprocess
        #process test
        def __funtest_process_and_thread_154344624_23432899302771945__():
            time.sleep(1)
            print("sb")
            return 0
        __funtest_process_and_thread_154344624_91234823878237489__#run function
        __funtest_process_and_thread_154344624_23432899302771945__
    
